//
//  GRSystemSettingViewCell.m
//  YC_GRice
//
//  Created by LiuFeng on 2018/7/14.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "GRSystemSettingViewCell.h"

@implementation GRSystemSettingViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)populateUserInfo:(GRPersonModel *)personModel atIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.row == 0) {
        _avatars.hidden = NO;
        _instructions.text = nil;
        [_avatars sd_setImageWithURL:[NSURL URLWithString:personModel.avatar] placeholderImage:[UIImage imageNamed:@"usercenter_14"]];
    }else {
        _avatars.hidden = YES;
        
        switch (indexPath.row) {
            case 1:
                _instructions.text = personModel.nickname;
                break;
                
            case 2:{
                NSString *gender = @"外星人";
                if ([personModel.gender isEqualToString:@"male"]) {
                    gender = @"男";
                }else if ([personModel.gender isEqualToString:@"female"]) {
                    gender = @"女";
                }
                _instructions.text = gender;
            }
                break;
                
            case 3:
                _instructions.text = personModel.passwordFlag ? @"修改密码" : @"未设置";
                break;
                
            case 4:
                _instructions.text = personModel.wechatFlag ? @"解绑" : @"未关联";
                break;
                
            default:
                _instructions.text = personModel.alipayFlag ? @"解绑" : @"未关联";
                break;
        }
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
